export function log(...args) {
  if (args.length === 0) {
    return
  }
  if (args.length > 2) {
    console.log(...args)
  } else {
    let realArgs = args
    if (args.length === 1) {
      realArgs = ['info', ...args]
    }
    const [title, text] = realArgs
    const color = `#ba7518`
    prettifyLog({ title, text, color })
  }
}

function prettifyLog({ title, text, color = '#333' }) {
  console.log(
    `%c ${title} %c ${text} %c`,
    `background:${color};border:1px solid ${color}; padding: 1px; border-radius: 2px 0 0 2px; color: #fff;`,
    `border:1px solid ${color}; padding: 1px; border-radius: 0 2px 2px 0; color: ${color};`,
    'background:transparent',
  )
}
